package org.liveboardgames.agricola.view.component
{
    import com.adobe.cairngorm.control.CairngormEventDispatcher;
    
    import org.liveboardgames.agricola.model.enums.ResourceTypeEnum;
    import org.liveboardgames.agricola.vo.common.IResourceContainer;
    import org.liveboardgames.common.dictionary.collections.HashCollection;
    
    import mx.events.DragEvent;
    import mx.managers.DragManager;
    
    public class FoodResourceBox extends ResourceBox
    {
        public function FoodResourceBox()
        {
            super();
        }
        
        protected override function onDragEnter(event:DragEvent):void
        {
            var dropTarget:ResourceBox = event.currentTarget as ResourceBox;
            
            if (event.dragSource.hasFormat('resource'))
            {
                var resourceImage:ResourceImage = ResourceImage(event.dragSource.dataForFormat('resource'));
                var resourceType:String = resourceImage.resourceType;
                
                if (ResourceTypeEnum.FEED_RESOURCES.contains(resourceType))
                {
                    DragManager.acceptDragDrop(dropTarget);
                }
            }
        
        }
    }
}